home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950329-19950528 / 000034_news@columbia.edu_Sun Apr 2 23:28:11 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA08780
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Sun, 2 Apr 1995 19:28:23 -0400
  3. Received: by apakabar.cc.columbia.edu id AA26641
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Sun, 2 Apr 1995 19:28:15 -0400
  5. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  6. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  7. Newsgroups: comp.protocols.kermit.misc
  8. Subject: Re: Capture macro
  9. Date: 2 Apr 1995 23:28:11 GMT
  10. Organization: Columbia University
  11. Lines: 51
  12. Message-Id: <3lnbub$q0d@apakabar.cc.columbia.edu>
  13. References: <796463548snz@childsoc.demon.co.uk>
  14. Nntp-Posting-Host: watsun.cc.columbia.edu
  15. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  16.  
  17. In article <796463548snz@childsoc.demon.co.uk>,
  18. Michael Bernardi <Mike@childsoc.demon.co.uk> wrote:
  19. >Has anyone written a macro which will capture on screen text, to a file,
  20. >without ESCape sequences. Invoked by pressing a key combination (eg Alt+C)
  21. >you get PROMPTED for a file name, which you can then type. Alternatively
  22. >you can be GIVEN a default name which can be edited.
  23. >
  24. >I'm not even sure if this is possible using MS-Kermit. I think I have
  25. >managed to getthis to work for a default filename. BUT I can't get user
  26. >imput to change this.
  27. >
  28. The screen is dumped to a file using the \Kdump verb.  This copies the
  29. on-screen text (without highlighting, colors, etc) to a plain-text file.  No
  30. escape sequences.  The default file is KERMIT.SCN in the current directory.
  31. If it already exists it is appended to.  The \Kdump verb is assigned to
  32. Ctrl-End by default, and you can move it around with SET KEY.  The screen-dump
  33. file can be changed with SET DUMP.  This is all in the manual.
  34.  
  35. You want a "hot key" that prompts the user for a filename to save the
  36. screen text to.  Well, we can write a macro to do this, and then assign it
  37. to the desired key, along with the \Kdump verb.  First let's write the macro.
  38.  
  39. define getdumpfile echo SCREEN DUMP REQUESTED,-
  40.   :loop,-
  41.   ask \%9 {File to dump to: },-
  42.   if not def \%9 goto loop,-
  43.   if exist \%9 goto done,-
  44.   open write \%9,-
  45.   if success goto ok,-
  46.   echo Error: \%9 can't be created,-
  47.   goto loop,-
  48.   :ok,-
  49.   close write,-
  50.   delete \%9,-  
  51.   :done,-
  52.   set dump \%9,-
  53.   connect
  54.  
  55. This macro not only prompts for the filename, but also checks whether the
  56. named file can actually be used; if not it goes back and reprompts.
  57.  
  58. Now to assign the whole process to (say) Alt-C (Alt-Shift-C), do:
  59.  
  60.   set key \2862 {\{Kgetdumpfile}\{Kdump}}
  61.  
  62. (The arrangement of braces and slashes is a bit mysterious, but is documented
  63. in the KERMIT.BWR file.)
  64.  
  65. Embellish or simplify as desired.
  66.  
  67. - Frank